<include file="Public/head" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/css/cashier.css" />
<include file="Public/common_header" />
<div class="mian">
    <div class="mianL">
        <include file="Public/sidebar" menu="jybggl.zysh"/>
    </div>
        <div class="mianR">
			<?php if ($res['is_having_last']): ?>
				<div class="lastChange">
					<h3 class="yonghu">上次变更单信息</h3>
		 			<div class="arbitration">
		 				<table>
		 					<tbody>
		 						<tr>
		                            <td>拍单号</td><td>{$res.order_no}</td>
		                            <td>变更单号</td><td>{$res.last_modify_no}</td>
		                        </tr>
		 						<tr>
		                            <td>变更原因</td><td><?php echo $modify_reason[$res['last_modify_reason']]; ?></td>
		                            <td>变更状态</td><td><?php echo $modify_status[$res['last_status']]; ?></td>
		                        </tr>
		                        <tr>
		                            <td>变更结果</td><td>
			                            <?php if ($res['last_modify_result'] == 1): ?>
											赔付
										<?php else: ?>
											订单关闭
			                            <?php endif ?>
		                            </td>
		                            <td>变更时间</td><td>{$res.last_createtime}</td>
		                        </tr>
		 						<tr>
		                            <td>变更描述</td><td colspan='3'>{$res.last_modify_desc}</td>
		                        </tr>
		 					</tbody>
		 				</table>
		 			</div>
					<?php if ($res['last_dealer_compensate'] > 0): ?>
						<h3 class="yonghu">车商处理</h3>
		 				<div class="payment-amount">赔付金额：{$res.last_dealer_compensate}元</div>
					<?php elseif ($res['last_owner_compensate'] > 0): ?>
						<h3 class="yonghu">车主处理</h3>
		 				<div class="payment-amount">赔付金额：{$res.last_owner_compensate}元</div>
					<?php endif ?>
	                
		 			<!--h3(2)-->
		 			<h3 class="yonghu">财务信息</h3>
		 			<div class="finance">
	<!-- 	 				<h4><span>付款账号信息</span></h4> -->
		 				<dl class="finance-right clearfix">
		 					<dt>开户名：</dt>
		                    <dd>{$res.last_account_name}</dd>
		 					<dt>银行帐号：</dt>
		                    <dd>{$res.last_card_no}</dd>
		 					<dt>银行名称：</dt>
		                    <dd>{$res.last_bank_name}</dd>
		 				</dl>
		 				<div class="clearfix"></div>
		 			</div>
				</div>
			<?php endif ?>
		<!-- 	<input type="hidden" id="is_having_last" value="{$res.is_having_last}">
			<input type="hidden" id="last_mid" value="{$res.last_mid}"> -->
            <h3 class="yonghu">仲裁审核</h3>
 			<div class="arbitration">
 				<table>
 					<tbody>
 						<tr>
                            <td>车辆名称</td><td>{$res.model}</td>
                            <td>拍单号</td><td>{$res.order_no}</td>
                        </tr>
 						<tr>
                            <td>车辆编号</td><td>{$res.sno}</td>
                            <td>发起时间</td><td>{$res.createtime}</td>
                        </tr>
 						<tr> 
                            <td>车主姓名</td><td>{$res.owner_name}</td>
                            <td>车主电话</td><td>{$res.owner_phone}</td>                            
                        </tr>
 						<tr>
                            <td>争议原因</td><td><?php echo $dispute_reason[$res['dispute_reason']]; ?></td>
                            <td>审核状态</td><td><?php echo $dispute_status[$res['status']];?></td>
                        </tr>
 						<tr>
                            <td>争议说明</td><td colspan="3">{$res.remark}</td>
                        </tr>
 						<tr><td>审核结果</td>  
 						<td colspan="3" align="left">
 							<div class="findings-audit">
	 						<input type="radio" value="1" checked="checked" name="adoptName" id="adopt"><label for="adopt">通过</label>
	 						<input type="radio" value="2" name="adoptName" id="reject"><label for="reject">驳回</label>
	 						<input type="radio" value="3" name="adoptName" id="default"><label for="default">违约</label>
	 						</div>
 						</td>
 						</tr>
 					</tbody>
 				</table>
 			</div>
 			<div class="change-order-cont">
 				<h3 class="yonghu">拍单变更单信息</h3>
 				<div class="arbitration">
 				<table class="single-change">
 					<tbody>
 						<tr>
                            <td width="15%">车辆名称</td>
                            <td colspan="3">{$res.model}</td>
                        </tr>
 						<tr>
                            <td width="15%">车辆编号</td>
                            <td width="35%">{$res.sno}</td>
                            <td width="15%">拍单号</td>
                            <td width="35%">{$res.order_no}</td>
                        </tr>
 						<tr><td>变更原因</td>
 						<td align="left">
 							<div class="change-reason">
								<!-- <input type="radio" checked="checked" name="testing" value="1" id="testing"><label for="testing">检测失误</label> -->
 								<input type="radio" name="testing" checked="checked" value="2" id="testing1"><label for="testing1">平台失误</label> 								
	 						</div>
 							<div class="change-reason1" style="display:none;">
 								<!-- <input type="radio"  name="buyDefault" value="3" id="buyDefault" style="display:none;"><label for="buyDefault" style="display:none;">买方违约</label> -->
	 							<input type="radio" checked="checked" name="buyDefault" value="4" id="buyDefault1"><label for="buyDefault1">卖方违约</label>
	 						</div>
	 					</td>
	 					<td rowspan="2">变更描述</td><td rowspan="2" align="left"><textarea placeholder="描述" class="change-describe"></textarea></td>
 						</tr>
	 					<tr style="border: none;">
	 						<td>变更结果</td>
	 						<td align="left">
	 							<div class="compensate">
 									<input type="radio" checked="checked" name="Payment" value="1" id="Payment"><label for="Payment">赔付</label>
	 								<input type="radio" name="Payment" value="2" id="Payment1"><label for="Payment1">订单关闭</label>
	 							</div>
	 						</td>
	 						<td style="border: none;"></td>
	 						<td style="border: none;"></td>	 			
	 					</tr>
 					</tbody>
 				</table>
 			</div>
 			</div>
 			
 			<!--车商处理赔付金额-->
 			<div class="car-handle">
				<h3 class="yonghu">车主处理</h3>
				<div class="cost-money">赔付金额<input type="text" value="" name='payment_amount' id="payment_amount_one" onkeyup="this.value=this.value.replace(/\D/g,'')" /><span>元</span></div>
 			</div>
			<script>
				$("#payment_amount_one").keyup(function(){
					if(parseInt($(this).val())>2000){
                        $(this).val($(this).val().substring(0,3));
                    }
				})
			</script>
 			<div class="car-handle1" style="display:none;">
	 			<h3 class="yonghu">车商处理</h3>
	 			<div class="arbitration">
	 				<table>
	 					<thead><tr><td>关联单据</td><td>费用项</td><td>退赔项</td><td>收扣款项</td></tr></thead>
	 					<tbody>
	 						<tr>
		 						<td width="20%">拍单号：{$res.order_no}</td>
		 						<td width="30%">
		 							<span>应收车款：{$res.final_price}元</span>
		 							<span>实收车款：<i class="paid-car">{$res.real_collection}</i>元</span>
		 						</td>
		 						<td width="30%">应退车款：{$res.real_collection}元</td>
		 						<td width="20%"></td></tr>
		 						<tr><td>赔款</td>
		 						<td></td>
		 						<td>
			 						<span class="cash-money">
			 							<input type="text" name="voucher" id="voucher1" onkeyup="this.value=this.value.replace(/\D/g,'')"  /><label for="voucher1">元</label>
			 						</span>
		 						</td>
		 						<td></td>
	 						</tr>
	 						<tr>
	 							<td>违约扣款</td>
	 							<td></td>
	 							<td></td>
	 							<td></td>
	 						</tr>
	 						<tr>
	 							<td>小计</td>
	 							<td></td>
	 							<td><span id='subtotal'></span>元</td>
	 							<td></td>
	 						</tr>
	 					</tbody>
	 				</table>
	 				<div id="finance_info" class="financial"></div>
	 			</div>
			</div>
			<script>
				var paymentsone=parseInt($(".paid-car").html());
				$("#subtotal").html(paymentsone);
				$("#voucher1").keyup(function(){
					if(parseInt($(this).val())>2000){
                        $(this).val($(this).val().substring(0,3));
                    }					
					if($(this).val()==""){
						var cash=0;
						var total=cash+paymentsone;
						$("#subtotal").html(total);
						$('#finance_info').html("财务付款："+total+"元");
						if (total > 0) {
							$('#refund').show();
						}else{
							$('#refund').hide();
						}
					}else{
						var cash=parseInt($(this).val());
						var total=cash+paymentsone;
						$("#subtotal").html(total);
						$('#finance_info').html("财务付款："+total+"元");
						if (total > 0) {
							$('#refund').show();
						}else{
							$('#refund').hide();
						}
					}						
				})
 			</script>
			
			<!--买方违约----车商处理赔付或者违约扣款-->
 			<div class="car-handle3" style="display:none;">
	 			<h3 class="yonghu">车商处理</h3>
	 			<div class="arbitration">
	 				<table>
	 					<thead><tr><td>关联单据</td><td>费用项</td><td>退/赔项</td><td>收扣款项</td></tr></thead>
	 					<tbody>
	 						<tr>
		 						<td width="20%">拍单号：{$res.order_no}</td>
		 						<td width="30%">
		 							<span>应收车款：{$res.final_price}元</span>
		 							<span>实收车款：<i class="real_collection">{$res.real_collection}</i>元</span>
		 						</td>
		 						<td width="30%">应退车款：{$res.real_collection}元</td>
		 						<td width="20%"></td>
	 						</tr>
	 						<tr>
		 						<td>赔款</td>
		 						<td></td>
		 						<td><span class="cash-money">
	 									<input type="text" name="dealer_void_payment" id="dealer_void_payment" onkeyup="this.value=this.value.replace(/\D/g,'')" /><label for="voucher1">元</label>
	 								</span></td>
		 						<td></td>
	 						</tr>
	 						<tr><td>违约扣款</td>
	 							<td></td>
	 							<td></td>
	 							<td></td>
 							</tr>
	 						<tr>
	 							<td>小计</td>
	 							<td></td>
	 							<td><span id='sub_coll_total'></span>元</td>
	 							<td></td>
	 						</tr>
	 					</tbody>
	 				</table>
	 				<div id="finance_info_two" class="financial"></div>
	 			</div>
			</div>
			<script>
				// var payments=parseInt($(".real_collection").html());
				// $("#sub_coll_total").html(payments+"元");
				var payment=parseInt($(".real_collection").html());
				$("#dealer_void_payment").keyup(function(){
					if(parseInt($(this).val())>2000){
                        $(this).val($(this).val().substring(0,3));
                    }					
					if($(this).val()==""){
						var cash=0;
						var total = payment+cash; 
						$("#sub_coll_total").html(total);
						if (total >= 0) {
							$('#finance_info_two').html("财务付款："+total+"元");
						}else{
							$('#finance_info_two').html("财务收款："+Math.abs(total)+"元");
						}
						if (total > 0) {
							$('#refund').show();
						}else{
							$('#refund').hide();
						}
					}else{
						var cash=parseInt($(this).val());
						var total = payment+cash; 
						$("#sub_coll_total").html(total);
						if (total >= 0) {
							$('#finance_info_two').html("财务付款："+total+"元");
						}else{
							$('#finance_info_two').html("财务收款："+Math.abs(total)+"元");
						}
						if (total > 0) {
							$('#refund').show();
						}else{
							$('#refund').hide();
						}
					}						
				})
 			</script>
			<!--卖方违约----车商处理赔付或者违约扣款-->
<!--  			<div class="car-handle4" style="display:none;">
	 			<h3 class="yonghu">车商处理</h3>
	 			<div class="arbitration">
	 				<table>
	 					<thead><tr><td>关联单据</td><td>费用项</td><td>退/赔项</td><td>收扣款项</td></tr></thead>
	 					<tbody>
	 						<tr>
	 							<td width="20%">拍单号：{$res.order_no}</td>
	 							<td width="30%">
	 								<span>应收车款：{$res.final_price}元</span>
	 								<span>实收车款：<i class="real_collection_two">{$res.real_collection}</i>元</span>
	 								</td>
	 							<td width="30%">应退车款：{$res.real_collection}元</td>
	 							<td width="20%"></td>
 							</tr>
	 						<tr>
		 						<td>退车赔款</td>
		 						<td></td>
		 						<td>
			 						<span class="cash-money">
			 							<input type="text" name="dealer_void_payment_two" id="dealer_void_payment_two" /><label for="voucher1">元</label>
			 						</span>
			 						<span class="cash-money1" style="display: none;"></span>
		 						</td>
		 						<td></td>
	 						</tr>
	 						<tr><td>违约扣款</td><td></td><td></td><td></td></tr>
	 						<tr>
	 							<td>小计</td>
	 							<td></td>
	 							<td><span id='sub_coll_total_two'></span></td>
	 							<td></td>
	 						</tr>
	 					</tbody>
	 				</table>
	 			</div>
			</div> -->
			<script>
 				// $(function(){
 				// 	var payments=parseInt($(".real_collection_two").html());
 				// 	$("#sub_coll_total_two").html(payments+"元");
 				// 	$("#dealer_void_payment_two").keyup(function(){ 						
 				// 		if($(this).val()==""){
 				// 			var cash=0;
 				// 			var total=cash+payments;
 				// 			$("#sub_coll_total_two").html(total+"元");
 				// 		}else{
 				// 			var cash=parseInt($(this).val());
 				// 			var total=cash+payments;
 				// 			$("#sub_coll_total_two").html(total+"元");
 				// 		}						
 				// 	})
 				// })
 			</script>
			<!--买方收款账号-->
			<div class="refund" id="refund" style="display:none;">
 				<h3>买方收款账号</h3>
 				<ul class="clearfix">
 					<li><span>开户名：</span><input type="text" value="" name="account_name" /></li>
 					<li><span>银行帐号：</span><input type="text" value="" name="bank_account" /></li>
 					<li><span>银行名称：</span><input type="text" value="" name="bank_name"></li>
 				</ul>
 			</div>
 			
 			<div class="reason-rejection clearfix" style="display: none;">
 				<span>驳回原因</span><textarea id="reject_result"></textarea>
 			</div>
 			<!--卖方违约----车主处理赔付或者违约扣款-->
 			<div class="car-owner" style="display:none;">
	 			<h3 class="yonghu">车主处置</h3>
	 			<div class="arbitration">
	 				<table>
	 					<thead><tr><td>关联单据</td><td>费用项</td><td>退/赔项</td><td>收扣款项</td></tr></thead>
	 					<tbody>
	 						<tr>
	 							<td width="20%">采购单号：{$res.purchase_order_nu}</td>
	 							<td width="30%">
	 								<span>应付车款：{$res.success_price}元</span>
	 								<span>实付车款：<i class="real_payment_one">{$res.real_payment}</i>元</span>
 								</td>
	 							<td width="30%"></td>
	 							<td width="20%">收回车款：{$res.real_payment}元</td>
	 						</tr>
	 						<tr>
		 						<td>赔款</td>
		 						<td></td>
		 						<td>
			 						<span class="cash-money">
			 							<input type="text" name="owner_void" id="owner_payment_amount" onkeyup="this.value=this.value.replace(/\D/g,'')" /><label for="voucher1">元</label>
			 						</span>
		 						</td>
		 						<td></td>
	 						</tr>
	 						<tr>
	 							<td>违约扣款</td>
	 							<td></td>
	 							<td></td>
	 							<td></td>
	 						</tr>
	 						<tr>
	 							<td>小计</td>
	 							<td></td>
	 							<td><span id='sub_pay_total_one'></span>元</td>
	 							<td>{$res.real_payment}元</td>
 							</tr>
	 					</tbody>
	 				</table>
	 				<div id="finance_info_one" class="financial"></div>
	 			</div>
 			</div>
 			<script>
 					$("#owner_payment_amount").keyup(function(){
 						if(parseInt($(this).val())>2000){
	                        $(this).val($(this).val().substring(0,3));
	                    }
 						var back_money = parseInt($('.real_payment_one').html());					
 						if($(this).val()==""){
 							var cash=0;
 							$("#sub_pay_total_one").html(cash);
 							var total = back_money - cash;
 							$('#finance_info_one').html("财务收款："+total+"元");
							// if (total >= 0) {
							// 	$('#refund').show();
							// }else{
							// 	$('#refund').hide();
							// }
 						}else{
 							var cash=parseInt($(this).val());
 							$("#sub_pay_total_one").html(cash);
 							var total = back_money - cash;
							if (total >= 0) {
								$('#finance_info_one').html("财务收款："+total+"元");
							}else{
								$('#finance_info_one').html("财务付款："+Math.abs(total)+"元");
							}

							// else if(car_source == 1){
							// 	if (total >= 0) {
							// 		$('#fours').hide();
							// 		$('#finance_info_one').html("财务收款："+total+"元");
							// 	}else{
							// 		$('#fours').show();
							// 		$('#finance_info_one').html("财务付款："+Math.abs(total)+"元");
							// 	}
							// }
 						}						
 					})

 			</script>
 			<!--卖方违约----车主处理赔付或者违约扣款-->
 			<div class="car-owner1" style="display:none;">
	 			<h3 class="yonghu">车主处置</h3>
	 			<div class="arbitration">
	 				<table>
	 					<thead><tr><td>关联单据</td><td>费用项</td><td>退/赔项</td><td>收扣款项</td></tr></thead>
	 					<tbody>
	 						<tr>
	 							<td width="20%">采购单号：{$res.purchase_order_nu}</td>
	 							<td width="30%">
	 								<span>应付车款：{$res.success_price}元</span>
	 								<span>实付车款：<i class="real_payment">{$res.real_payment}</i>元</span>
	 							</td>
	 							<td width="30%"></td>
	 							<td width="20%">收回车款：{$res.real_payment}元</td>
 							</tr>
	 						<tr><td>赔款</td><td></td><td></td><td></td></tr>
	 						<tr><td>违约扣款</td><td></td><td></td>
	 							<td><span class="cash-money"><input type="text" name="owner_void" id="owner_void" onkeyup="this.value=this.value.replace(/\D/g,'')" /><label for="voucher1">元</label></span></td>
 							</tr>
	 						<tr><td>小计</td>
		 						<td></td>
		 						<td></td>
		 						<td><span id='sub_pay_total'></span>元</td>
	 						</tr>
	 					</tbody>
	 				</table>
	 				<div id="finance_info_three" class="financial"></div>
	 			</div>
 			</div>
 			<script>
				var payments=parseInt($(".real_payment").html());
				$("#sub_pay_total").html(payments+"元");
				$("#owner_void").keyup(function(){
					if(parseInt($(this).val())>2000){
                        $(this).val($(this).val().substring(0,3));
                    }						
					if($(this).val()==""){
						var cash=0;
						var total=cash+payments;
						$("#sub_pay_total").html(total);
						if (total >= 0) {
							$('#finance_info_three').html("财务收款："+total+"元");
						}else{
							$('#finance_info_three').html("财务付款："+Math.abs(total)+"元");
						}

						// else if(car_source == 1){
						// 	if (total >= 0) {
						// 		$('#fours').hide();
						// 		$('#finance_info_three').html("财务收款："+total+"元");
						// 	}else{
						// 		$('#fours').show();
						// 		$('#finance_info_three').html("财务付款："+Math.abs(total)+"元");
						// 	}
						// }

					}else{
						var cash=parseInt($(this).val());
						var total=cash+payments;
						$("#sub_pay_total").html(total);
						if (total >= 0) {
							$('#finance_info_three').html("财务收款："+total+"元");
						}else{
							$('#finance_info_three').html("财务付款："+Math.abs(total)+"元");
						}
					}						
				})
 			</script>
 			<!-- <div class="refund" id="refund1" style="display:none;">
 				<h3>卖方收款账号(个人)</h3>
 				<ul class="clearfix">
 					<li><span>开户名：</span>{$res.payee_name}</li>
 					<li><span>银行帐号：</span>{$res.payee_account}</li>
 					<li><span>银行名称：</span>{$res.deposit_bank}</li>
 				</ul>
 			</div> -->

 			<!-- <div style="display:none;" id="fours">
 				<span>打款账号</span>
	            <input type="hidden" name="bank_name" id="bank_name" value="">
	            <input type="hidden" name="card_no" id="card_no" value="">
	            <input type="hidden" name="account_name" id="account_name" value="">
	            <div class="account">
	                <ul>
	                    <volist name="fours_bank_account" id="fba" key="k">
	                        <li class="clearfix" data-bank-name="{$fba.bank_name}" data-card-no="{$fba.card_no}" data-account-name="{$fba.account_name}">
	                            <if condition="$fours_bank_account_total gt 1">
	                                <div>
	                                    <span class="span_right">打款帐号{$k}&nbsp;&nbsp;</span>
	                                </div>
	                            </if>
	                            <div>
	                                <span class="span_right">开户银行：</span>
	                                <span>{$fba.bank_name}</span>
	                            </div>
	                            <div>
	                                <span class="span_right">银行账号：</span>
	                                <span>{$fba.card_no}</span>
	                            </div>
	                            <div>
	                                <span class="span_right">账户名：</span>
	                                <span>{$fba.account_name}</span>
	                            </div>
	                        </li>
	                    </volist>
	                </ul>
	            </div>
 			</div> -->
            
 			<div class="yongBtn clearfix">
	            <input type="hidden" name="re_auction_type" value="">
	            <input type="hidden" name="first_money" value="">
	            <input type="submit" value="提交" class="queding">
	            <input class="quxiao" type="submit" value="返回" onclick="history.go(-1)">
        	</div>
        </div>        
    <div class="clear"></div>
</div>
<script>
	$(function(){
		$(".findings-audit input").click(function(){
			$(".change-reason input").eq(0).click();
			$(".compensate input").eq(0).click();
			if($(this).index()==0){
				$(".car-handle1").hide();
				$(".reason-rejection").hide();
				$(".change-order-cont").show();
				$(".car-handle").show();
				$("#refund").hide();
				$(".compensate").show();
				$(".change-reason").show();
				$(".change-order-cont table tr:last-child").show();
				$(".change-reason1").hide();
				$(".car-handle3").hide();
			}else if($(this).index()==2){
				$(".car-handle").hide();
				$(".car-handle1").hide();
				$(".car-handle2").hide();
				$(".car-owner").hide();
				$("#refund").hide();
				$(".change-order-cont").hide();
				$(".reason-rejection").show();
				$(".car-handle3").hide();
			}else if($(this).index()==4){
				$(".change-reason1 input").eq(0).click();
				$(".change-reason1 input").attr("checked",true)
				$("#refund").show();
				$(".change-reason").hide();
				$(".change-reason1").show();
				$(".change-order-cont table tr:last-child").hide();
				$(".car-handle3").show();
				$(".car-handle").hide();
				$(".car-handle1").hide();
				$(".car-handle2").hide();
				$(".car-owner").hide();
				$(".reason-rejection").hide();
				$(".change-order-cont").show();
				$(".car-owner1").show();
				$("#refund").css("marginBottom","20px");
				var paymentOne =parseInt($(".real_collection").html());
				var dealer_void_payment = parseInt($("#dealer_void_payment").val());
				if (isNaN(dealer_void_payment)) {
					dealer_void_payment = 0;
				};
				var totalthree = dealer_void_payment + paymentOne;
				$("#sub_coll_total").html(totalthree);
				$('#finance_info_two').html("财务付款："+totalthree+"元");
				if (totalthree > 0) {
					$('#refund').show();
				}else{
					$('#refund').hide();
				}

				var paymentTwo =parseInt($(".real_payment").html());
				var owner_void = parseInt($("#owner_void").val());
				if (isNaN(owner_void)) {
					owner_void = 0;
				};
				var totalfour = paymentTwo + owner_void;
				$("#sub_pay_total").html(totalfour);
				$('#finance_info_three').html("财务收款："+totalfour+"元");
					
			}			
		})
		
		$(".change-reason input").eq(0).click(function(){
			
			// $(".compensate input").eq(0).click();
			if($(this).index()==0){
				$(".compensate input").eq(1).click(function(){
					$(".car-handle").hide();
					$(".car-handle1").show();
					$(".car-handle2").hide();
					$(".car-handle3").hide();
					$(".car-owner").show();
					$(".car-handle4").hide();
			        $(".car-owner1").hide();
				})
			}
		})
		$(".change-reason input").eq(1).click(function(){
			
			if($(this).index()==1){
				$(".car-handle").hide();
				$(".car-handle1").hide();
				$(".car-handle2").show();
				$(".car-owner").show();	
				$("#refund").css("marginBottom","20px");
				$(".compensate input").eq(1).attr("checked","checked");
				$(".compensate input").eq(1).click(function(){
					$(".car-handle").hide();
					$(".car-handle1").hide();
					$(".car-handle2").show();
					$(".car-handle3").hide();
					$(".car-owner").show();
					$(".car-handle4").hide();
					$(".car-owner1").hide();
					
				})
			}
			
		})
		$(".compensate input").eq(0).click(function(){
			
			$(".car-handle").show();
			$(".car-handle1").hide();
			$(".car-handle2").hide();
			$(".car-handle3").hide();
			$(".car-owner").hide();
			$(".car-handle4").hide();
			$(".car-owner1").hide();
			$("#refund").hide();
		})
		$(".compensate input").eq(1).click(function(){

			$(".car-handle").hide();
			$(".car-handle1").show();
			$(".car-handle2").hide();
			$(".car-handle3").hide();
			$(".car-owner").show();
			$(".car-handle4").hide();
			$(".car-owner1").hide();
			var paymentstwo=parseInt($(".paid-car").html());
			var voucher1 = parseInt($("#voucher1").val());
			if (isNaN(voucher1)) {
				voucher1 = 0;
			};
			var totalone = paymentstwo + voucher1;
			$("#subtotal").html(totalone);
			$('#finance_info').html("财务付款："+totalone+"元");
			if (totalone > 0) {
				$('#refund').show();
			}else{
				$('#refund').hide();
			}
			var back_money = parseInt($('.real_payment_one').html());
			var owner_payment_amount = parseInt($('#owner_payment_amount').val());
			if (isNaN(owner_payment_amount)) {
				owner_payment_amount = 0;
			};
			var totaltwo = back_money - owner_payment_amount;
			$("#sub_pay_total_one").html(owner_payment_amount);

			// var car_source = {$res.car_source};
			// if (car_source == 2) {
			// 	if (back_money >= 0) {
			// 		$('#refund1').hide();
			// 	}else{
			// 		$('#refund1').show();
			// 	}
			// }else if(car_source == 1){
			// 	if (back_money >= 0) {
			// 		$('#fours').hide();
			// 	}else{
			// 		$('#fours').show();
			// 	}
			// }	
			$('#finance_info_one').html("财务收款："+totaltwo+"元");
			$("#refund").css("marginBottom","20px");	
		})
		// $(".change-reason1 input").eq(1).click(function(){
		// 	$(".car-handle3").hide();
		// 	$(".car-handle4").show();
		// 	$(".car-owner1").show();
		// 	$("#refund").css("marginBottom","20px");
		// })
		
	})

	$(".queding").click(function(){
		var verify_res = $('input[name="adoptName"]:checked').val();
		// var is_having_last = $('#is_having_last').val();
		// var last_mid = $('#last_mid').val();
		if (verify_res < 1) {
	            shibai_alert1('请选择审核结果');
	            return;
	        };
		if (verify_res == 1) {
			var modify_reason = $('input[name="testing"]:checked').val();
			var modify_desc = $('.change-describe').val();
			var modify_result = $('input[name="Payment"]:checked').val();
			//收款账号信息
			var account_name = $('input[name="account_name"]').val();
			var bank_account = $('input[name="bank_account"]').val();
			var bank_name =  $('input[name="bank_name"]').val();

			if (modify_result == 1) {
				var payment_amount = $('input[name="payment_amount"]').val();
				if (payment_amount == '' || payment_amount <= 0) {
					shibai_alert1('赔付金额应大于零');
		            return;
				};
			}else if(modify_result == 2){
				var real_pay = $('.paid-car').html();
				var payment_amount = $('#voucher1').val();
				if (payment_amount == '') {
					shibai_alert1('请填写赔付金额');
		            return;
				};
				if (real_pay + payment_amount > 0) {
					if (account_name == '') {
			            shibai_alert1('请填写开户名');
			            return;
			        };
					if (bank_account == '') {
			            shibai_alert1('请填写银行帐号');
			            return;
			        };
					if (bank_name == '') {
			            shibai_alert1('请填写银行名称');
			            return;
			        };
				};
			}
			var od_type = {$res.od_type};

	        
	        if (payment_amount >2000) {
	        	shibai_alert1('金额不能大于2000元');
	            return;
	        };
			var param = {
				// 'is_having_last':is_having_last,
				// 'last_mid':last_mid,
				'modify_reason':modify_reason,
				'modify_desc':modify_desc,
				'modify_result':modify_result,
				'payment_amount':payment_amount,
				'account_name':account_name,
				'bank_account':bank_account,
				'bank_name':bank_name,
				'od_type':od_type
			}
			if (modify_result == 2) {
				var owner_payment_amount = $('#owner_payment_amount').val();
				if (owner_payment_amount == '') {
					shibai_alert1('请填写赔付金额');
		            return;
				};
				if (owner_payment_amount >2000) {
		        	shibai_alert1('金额不能大于2000元');
		            return;
		        };
				param.owner_payment_amount =owner_payment_amount;
			};
			var btn_obj = $(this);
        	btn_obj.val("提交中...").attr("disabled", 'disabled');
        	console.log(param);
			$.post("/Dispute/disputePass/did/{$res.did}",param, function(data){
	     		if (data.code == 200) {
     				delay_alert(data.msg, 300);
                    setTimeout(function () {
                        btn_obj.val("提交").removeAttr("disabled style");
                         window.location.href='/Dispute/index';
                    }, 400);
     			}else{
     				btn_obj.val("提交").removeAttr("disabled style");
                	delay_alert(data.msg, 300);
     			}
	        },"json");

		}
		else if (verify_res == 2) {
			var reject_result = $('#reject_result').val();
			if (reject_result == '') {
            	shibai_alert1('请填写驳回原因');
	            return;
	        };
			var btn_obj = $(this);
        	btn_obj.val("提交中...").attr("disabled", 'disabled');
			$.post("/Dispute/disputeReject/did/{$res.did}",{'reject_result':reject_result}, function(data){
	     			if (data.code == 200) {
	     				delay_alert(data.msg, 300);
	                    setTimeout(function () {
	                        btn_obj.val("提交").removeAttr("disabled style");
	                         window.location.href='/Dispute/index';
	                    }, 400);
	     			}else{
	     				btn_obj.val("提交").removeAttr("disabled style");
                    	delay_alert(data.msg, 300);
	     			}
	        },"json");
		}
		else if (verify_res == 3) {   
			var buyDefault = $('input[name="buyDefault"]:checked').val();
			var modify_desc = $('.change-describe').val();
			var od_type = {$res.od_type};
			var modify_result = 2;
			//收款账号信息
			var account_name = $('input[name="account_name"]').val();
			var bank_account = $('input[name="bank_account"]').val();
			var bank_name =  $('input[name="bank_name"]').val();
			// if (buyDefault == 3) {
			// 	var payment_amount = $('#dealer_void_payment').val();
			// };
			if (buyDefault == 4) {
				var real_coll = $('.real_collection').html();
				var payment_amount = $('#dealer_void_payment').val();
				if (payment_amount =='') {
					shibai_alert1('请填写赔付金额');
		            return;
				};
				if (real_coll + payment_amount > 0) {
					if (account_name == '') {
			            shibai_alert1('请填写开户名');
			            return;
			        };
					if (bank_account == '') {
			            shibai_alert1('请填写银行帐号');
			            return;
			        };
					if (bank_name == '') {
			            shibai_alert1('请填写银行名称');
			            return;
			        };
				};
			};
			if (payment_amount >2000) {
	        	shibai_alert1('金额不能大于2000元');
	            return;
	        };
			
			var param = {
				// 'is_having_last':is_having_last,
				// 'last_mid':last_mid,
				'modify_reason':buyDefault,
				'modify_desc':modify_desc,
				'modify_result':modify_result,
				'payment_amount':payment_amount,
				'account_name':account_name,
				'bank_account':bank_account,
				'bank_name':bank_name,
				'od_type':od_type
			}
			if(buyDefault == 4){
				var owner_payment_amount = $('#owner_void').val();
				if (owner_payment_amount =='') {
					shibai_alert1('请填写扣款金额');
		            return;
				};
				if (owner_payment_amount >2000) {
		        	shibai_alert1('金额不能大于2000元');
		            return;
		        };
				param.owner_payment_amount = owner_payment_amount;
			}
			var btn_obj = $(this);
        	btn_obj.val("提交中...").attr("disabled", 'disabled');
			$.post("/Dispute/disputeViolate/did/{$res.did}",param, function(data){
	     		if (data.code == 200) {
     				delay_alert(data.msg, 300);
                    setTimeout(function () {
                        btn_obj.val("提交").removeAttr("disabled style");
                         window.location.href='/Dispute/index';
                    }, 400);
     			}else{
     				btn_obj.val("提交").removeAttr("disabled style");
                	delay_alert(data.msg, 300);
     			}
	        },"json");
		}else{
			return false; 
		}
	})
</script>
</body>
</html>